home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bchelp10.zip / TI708.ASC < prev    next >
Text File  |  1991-09-18  |  2KB  |  67 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland C++                            NUMBER  :  708
  9.   VERSION  :  2.0
  10.        OS  :  DOS
  11.      DATE  :  September 18, 1991                       PAGE  :  1/1
  12.  
  13.     TITLE  :  How to Warm or Cold Boot Computer
  14.  
  15.  
  16.  
  17.  
  18.   /********************************************************************
  19.   This code will let the user specify whether to perform a cold or
  20.   warm boot based on the command line option (Warm boot: 'W' or
  21.   'S'; any other character results in a cold boot).
  22.   *********************************************************************/
  23.  
  24.   #include <stdio.h>
  25.   #include <dos.h>
  26.   #include <ctype.h>
  27.  
  28.   int main (int argc, char *argv[])
  29.   {
  30.     void (far *bootsystem) (void);
  31.  
  32.     if ((toupper (argv[1][0]) == 'W')
  33.        || (toupper (argv[1][0]) == 'S'))
  34.         { /* Setting this memory location to this value will result
  35.              in memory not being checked a.k.a. Warm Boot    */
  36.  
  37.         unsigned far *warm;
  38.         /* Make a far pointer that points to the specified memory
  39.            location that is checked when the system is rebooted  */
  40.         warm = MK_FP (0x0000, 0x0472);
  41.  
  42.         /* Assign constant to farpointer indicating that memory is
  43.            not to be checked
  44.         */
  45.         *warm = 0x1234;
  46.         puts ("\nWarm boot in progress...\n");
  47.        }
  48.     else     /* memory will be checked a.k.a. Cold Boot */
  49.       puts ("\nCold boot in progress...\n");
  50.  
  51.       /* Assign far function pointer to the required far pointer
  52.          for reboot */
  53.     bootsystem = MK_FP (0xFFFF, 0x0000);
  54.  
  55.     /* Invoke the reboot process */
  56.     (*bootsystem) ();
  57.  
  58.     return (0);
  59.   }
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.